<template>
  <div class="PayResults">
    <div class="header">
      <div class="bg">
        <img src="../../assets/img/PayResults/invalid-name.svg" alt="">
      </div>
      <div class="text">
        <div class="icon"><i class="iconfont icon-wancheng"></i></div>
        <div class="title">恭喜您成功开通</div>
        <div class="doc">“十分读书”会员，即刻开启阅读之旅</div>
      </div>
    </div>
    <div class="bodyer">
      <img :src="$route.query.img" alt="">
      <div class="btns">
        <btn :obj='btnstyle' :text="textbtn" v-on:statr="post_order()"></btn>
      </div>
    </div>
  </div>
</template>

<script>
  import btn from '../../components/btn/index'

  export default {
    name: 'index',
    data: function () {
      return {
        btnstyle: {
          backgroundColor: '#ffd000',
          width: '60%',
          color: '#66440a',
          boxShadow: '0 10px 24px 0 rgba(255, 208, 0, 0.4)',
          opacity: 1
        },
        textbtn: '立即阅读'
      }
    },
    mounted: function () {
      sessionStorage.removeItem('Details')
    },
    methods: {
      post_order: function () {
        this.Upimg(res => {
          if (res === -1) {
            sessionStorage.setItem('Home', 'Book')
            this.$router.push({
              name: 'Binding',
            })
          } else {
            sessionStorage.setItem('Home', 'Book')
            this.$router.push({
              name: 'Home',
            })
          }
        })
        // sessionStorage.setItem('Home', 'Book')
        // this.$router.push({
        //   name: 'Home',
        // })
      },
      Upimg: function (callback) {
        this.$axios.adver_list({
          adver_type: 4
        }).then(res => {
          callback(parseInt(res.data.qing_data.user_info.user_phone))
        })
      },
    },
    components: {btn}
  }
</script>

<style scoped>
  @import "../../assets/css/views/PayResults/index.css";
</style>
